fix: maturin build --sdist wheel name/layout for excluded workspace crates#3031
Merged
Merged
Conversation
… crates When a crate is excluded from its Cargo workspace and has path dependencies outside its directory, the sdist places pyproject.toml at the sdist root while the Cargo.toml lives in a subdirectory. After unpacking, `resolve_manifest_paths` walks up from the Cargo.toml but stops at the cargo workspace boundary (which for an excluded crate is the crate's own directory), never reaching the pyproject.toml. This caused module-name, project name, and python-source to be lost, producing wheels with the wrong name and missing python files. Fix by threading the known pyproject.toml path from `unpack_sdist` through `BuildContextBuilder` into `ProjectResolver::resolve`, so the discovery walk is skipped when the path is already known. Also canonicalize the unpacked sdist directory to resolve symlinks (e.g. /var -> /private/var on macOS), which otherwise causes `project_root` and `python_dir` to disagree after `normalize()`, silently excluding python source files from wheels. Closes PyO3#3030
bmwiedemann
pushed a commit
to bmwiedemann/openSUSE
that referenced
this pull request
Mar 31, 2026
https://build.opensuse.org/request/show/1343551 by user mia + anag_factory - Drop CVE-2026-25727.patch (handled in _service) - Update to 1.12.6 * Sync legacy_py.rs with upstream PyPI warehouse legacy.py gh#PyO3/maturin#3053 * Keep cargo build artifact at original path after staging gh#PyO3/maturin#3054 - Update to 1.12.5 * feat: include debug info files (.pdb, .dSYM, .dwp) in wheels gh#PyO3/maturin#3024 * Fix wrong abi3 tag for conditional cargo features enabled pyo3 abi3 feature gh#PyO3/maturin#3029 * fix: maturin build --sdist wheel name/layout for excluded workspace crates gh#PyO3/maturin#3031 * fix: preserve wheel output dir when building from unpacked sdist gh#PyO3/maturin#3036 * feat: add python-implementation condition to conditional features gh#PyO3/maturin#3038 * Fix non-existent comment tag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a crate is excluded from its Cargo workspace and has path dependencies outside its directory, the sdist places pyproject.toml at the sdist root while the Cargo.toml lives in a subdirectory. After unpacking,
resolve_manifest_pathswalks up from the Cargo.toml but stops at the cargo workspace boundary (which for an excluded crate is the crate's own directory), never reaching the pyproject.toml. This caused module-name, project name, and python-source to be lost, producing wheels with the wrong name and missing python files.Fix by threading the known pyproject.toml path from
unpack_sdistthroughBuildContextBuilderintoProjectResolver::resolve, so the discovery walk is skipped when the path is already known.Also canonicalize the unpacked sdist directory to resolve symlinks (e.g. /var -> /private/var on macOS), which otherwise causes
project_rootandpython_dirto disagree afternormalize(), silently excluding python source files from wheels.Closes #3030